import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:vista/shared/utils/widget_extension.dart';

/// 空白画布
/// 用于显示空状态，当列表为空时显示此组件
class VacantState extends StatelessWidget {
  /// 显示文本
  final String message;

  /// 图片路径（empty1.png 或 empty2.png）
  final String imagePath;

  /// 图片宽度
  final double? imageWidth;

  /// 图片高度
  final double? imageHeight;

  /// 文本样式
  final TextStyle? textStyle;

  const VacantState({
    super.key,
    required this.message,
    this.imagePath = 'assets/images/empty1.png',
    this.imageWidth,
    this.imageHeight,
    this.textStyle,
  });

  @override
  Widget build(BuildContext context) {
    return Center(
      child: [
            // 图片
            Image.asset(
              imagePath,
              width: imageWidth ?? 200.w,
              height: imageHeight ?? 172.w,
              fit: BoxFit.contain,
            ),
            SizedBox(height: 24.h),
            // 文本
            Text(
              message,
              style:
                  textStyle ??
                  TextStyle(fontSize: 16.sp, color: Colors.grey[600]),
              textAlign: TextAlign.center,
            ),
          ]
          .verticalShot(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
          )
          .frameHorizontal(24.w),
    );
  }
}
